var cgftform = Ext.create('Ext.form.Panel', {
    store: ['sale.xsckdStore'],
	bodyPadding: 15,
	layout: 'column',
	width:900,
	baseCls: 'x-plain',
	items:[
			{
				 style: 'margin:10px 0px 0px 45px;',
				 xtype: 'testText1',
				 name: 'maker',
				 bodyPadding: 5,
				 fieldLabel: '制单人员',
				 width: 250,
				 labelWidth: 80,
			},
			{
				 style: 'margin:10px 0px 0px 45px;',
				 xtype: 'testText1',
				 name: 'permitter',
				 bodyPadding: 5,
				 fieldLabel: '复核人员',
				 width: 250,
				 labelWidth: 80,
			}
	      ]
});
var cgftgrids = Ext.create('Ext.grid.Panel',{
	store: ['sale.xsckdStore'],
	height: 160,
	stripeRows:true,   
	autoScroll:false,
	columns: [
				{xtype: 'rownumberer', header: '（栏号）', name: 'lineId', dataIndex: 'lineId', width: 50,sortable: false },
        		{header: '费用编号', dataIndex: '', width: 100 ,editor:"textfield"},
       			{header: '费用名称', dataIndex: '', width: 120,editor:"textfield" },
       			{header: '币别', dataIndex: '' ,editor:"textfield"},
				{header: '汇率', dataIndex: '' ,editor:"textfield"},
				{header: '金额', dataIndex: 'quantity',editor:"textfield"},
				{header: '近本位币', dataIndex: 'oldPrice',editor:"textfield" }
			 ],
	plugins: [  
			   Ext.create('Ext.grid.plugin.CellEditing',{  
				   clicksToEdit:1 //设置单击单元格编辑  
			   })  
			  ],  
	listeners:{
			    //双击行事件  
		itemdblclick:function(dataview, record, item, index, e){
			alert('itemdblclick');
			var data  = {  
			};
			//添加一行表格
			this.getStore().add(data);
		}
	}
		 
});

var cgftgridsa = Ext.create('Ext.grid.Panel',{
	store: ['sale.xsckdStore'],
	height: 160,
	stripeRows:true,   
	autoScroll:false,
	columns: [
				{xtype: 'rownumberer', header: '（栏号）', name: 'lineId', dataIndex: 'lineId', width: 50,sortable: false },
        		{header: '采购入库单号', dataIndex: '', width: 100 ,editor:"textfield"},
       			{header: '物料编号', dataIndex: '', width: 120,editor:"textfield" },
       			{header: '物料名称', dataIndex: '' ,editor:"textfield"},
				{header: '规格型号', dataIndex: '' ,editor:"textfield"},
				{header: '采购金额', dataIndex: 'quantity',editor:"textfield"},
				{header: '数量', dataIndex: 'oldPrice',editor:"textfield" },
				{header: '单位', dataIndex: 'quantity',editor:"textfield"},
				{header: '重量', dataIndex: 'quantity',editor:"textfield"},
				{header: '材积', dataIndex: 'quantity',editor:"textfield"},
				{header: '分摊金额', dataIndex: 'quantity',editor:"textfield"}
			 ],
	plugins: [  
			   Ext.create('Ext.grid.plugin.CellEditing',{  
				   clicksToEdit:1 //设置单击单元格编辑  
			   })  
			  ],  
	listeners:{
			    //双击行事件  
		itemdblclick:function(dataview, record, item, index, e){
			alert('itemdblclick');
			var data  = {  
			};
			//添加一行表格
			this.getStore().add(data);
		}
	}
		 
});

var cgftfilterPanel = Ext.create('Ext.panel.Panel', {
    width: 1000,
    items:[cgftgrids]
});

var cgftfilterPanels = Ext.create('Ext.panel.Panel', {
    width: 1200,
    items:[cgftgridsa]
});

var  cgfttableds = Ext.create('Ext.TabPanel',{
	width: 950,
	height: 230,
	autoScroll:true,
	style: 'margin:10px 0px 0px 60px',
	items: [{title:'费用明细',autoScroll:true,items:[cgftfilterPanel]},{title:'分摊结果',autoScroll:true,items:[cgftfilterPanels]},{title:'备注'}]
});



Ext.define("Demo.view.purchase.cgftPanel",{
	extend:"Ext.panel.Panel",
	alias:"widget.cgftPanel",
	type:'margin-left:50px',
	width:950,
	type:{
		'border':'1px solid red'
	},
	items:[{
		xtype:"topBar",
		id: "xsckdTops",
		store: Ext.create("Demo.store.empStore",{})
	},{
		xtype:"form",
		layout:'column',
		items:[{
			xtype:"datefield",
			name:"billdate",
			fieldLabel:"单据日期",
			style: 'margin:10px 0px 0px 60px',
			bodyPadding: 5,
			width: 250,
			labelWidth: 80
			
		},{
			xtype:"testText1",
			name:"empName",
			fieldLabel:"单据号码"
		},{
			xtype:'testText1',
			name:"empName",
			fieldLabel:"分摊方式",
			
//			stateId:"readOnly"
		},{
			xtype:"testText1",
			name:"empName",
			fieldLabel:"凭证编号"
//			stateId:"readOnly"
		},{
			xtype:"numberfield",
			name:"empName",
			fieldLabel:"金额本位币",
			decimalPrecision:2,   
			allowDecimals:true,
			style: 'margin:10px 0px 0px 60px',
			bodyPadding: 5,
			width: 250,
			labelWidth: 80
//			stateId:"readOnly"
		},cgfttableds,cgftform,{
			xtype:'splitbutton',
			text:'功能',	
			width:90,
			menu:{
				xtype:'menu',
				items:[{
					text:'载入来源',handler:function(){
						alert('11111');
					}
				},{
					text:'自动分摊',handler:function(){
						alert('11111');
					}
				}]
				
			}
		}]
	}]
});